package com.quanyan.weichat.protocol.common_protocal;

import java.io.Serializable;

/**
 * Created by zijun.song on 2015/7/2.
 */
public class WeichatJSConfig implements Serializable {

    private Boolean debug;

    private String appId ;//Configure.getAppid();

    private String timestamp  ;

    private String nonceStr;

    private String signature;

    private String[] jsApiList ;

    public WeichatJSConfig(Boolean debug, String[] jsApiList , String url ) {
        this(url);
        try {
            this.debug = debug;
            this.jsApiList = jsApiList;
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public WeichatJSConfig(String url) {
//        Map<String, Object> map = new HashMap<String,Object>();
//        CacheApi cacheApi = new JedisCacheApi();
//        String ticket = cacheApi.getValue("app_wx_jsapi_ticket","ticket");
//        this.timestamp = ""+(System.currentTimeMillis()/1000);
//        this.nonceStr = RandomStringGenerator.getRandomStringByLength(32);
//        String string = "jsapi_ticket="+ticket + "&noncestr=" + nonceStr + "&timestamp=" + timestamp + "&url=" + url;
//        Util.log("sign ==> " + string);
//        this.signature= new SHA1().getDigestOfString(string.getBytes()).toLowerCase();
//        Util.log("sign Result ==> " + this.signature);
    }

    public boolean isDebug() {
        return debug;
    }

    public void setDebug(boolean debug) {
        this.debug = debug;
    }

    public String getAppId() {
        return appId;
    }

    public void setAppId(String appId) {
        this.appId = appId;
    }

    public String getNonceStr() {
        return nonceStr;
    }

    public void setNonceStr(String nonceStr) {
        this.nonceStr = nonceStr;
    }

    public String getSignature() {
        return signature;
    }

    public void setSignature(String signature) {
        this.signature = signature;
    }

    public String[] getJsApiList() {
        return jsApiList;
    }

    public void setJsApiList(String[] jsApiList) {
        this.jsApiList = jsApiList;
    }

    public String getTimestamp() {
        return timestamp;
    }

    public void setTimestamp(String timestamp) {
        this.timestamp = timestamp;
    }


}
